﻿using System.ComponentModel.DataAnnotations;

namespace Communication.Enums;

// Modbus 标准异常码定义
public enum ModbusExceptionCode : byte
{
    /// <summary>
    ///     不支持的功能码
    /// </summary>
    [Display(Name = "不支持的功能码")] IllegalFunction = 0x01,

    /// <summary>
    ///     非法数据地址
    /// </summary>
    [Display(Name = "非法数据地址")] IllegalDataAddress = 0x02,

    /// <summary>
    ///     非法数据值
    /// </summary>
    [Display(Name = "非法数据值")] IllegalDataValue = 0x03,

    /// <summary>
    ///     从设备故障
    /// </summary>
    [Display(Name = "从设备故障")] SlaveDeviceFailure = 0x04,

    /// <summary>
    ///     请求已接收，正在处理中
    /// </summary>
    [Display(Name = "请求已接收，正在处理中")] Acknowledge = 0x05,

    /// <summary>
    ///     从站设备忙
    /// </summary>
    [Display(Name = "从站设备忙")] SlaveDeviceBusy = 0x06,

    /// <summary>
    ///     编程命令未执行
    /// </summary>
    [Display(Name = "编程命令未执行")] NegativeAcknowledge = 0x07,

    /// <summary>
    ///     内存奇偶校验错误
    /// </summary>
    [Display(Name = "内存奇偶校验错误")] MemoryParityError = 0x08,

    /// <summary>
    ///     从站设备不支持请求的功能
    /// </summary>
    [Display(Name = "从站设备不支持请求的功能")] GatewayPathUnavailable = 0x0A,

    /// <summary>
    ///     网关目标设备无响应
    /// </summary>
    [Display(Name = "网关目标设备无响应")] GatewayTargetDeviceFailedToRespond = 0x0B
}